package com.itheima.controller;

import com.github.pagehelper.Page;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageResult;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.java.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RequestMapping("/log")
@RestController
public class LogController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/page")
    public Result logPage(@RequestParam(defaultValue = "1") Integer Page,@RequestParam(defaultValue = "10") Integer pageSize) {
        log.info("日志信息,第{}页,共{}页",Page,pageSize);
        PageResult<OperateLog> pageResult = reportService.page(Page, pageSize);
        return Result.success(pageResult);
    }
}
